home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / A.D. Software / OOFILE / Buildable, limited OOFILE / samples / ooftst04.cpp < prev    next >
C/C++ Source or Header  |  1996-02-07  |  1KB  |  49 lines

  1. // Copyright 1994 A.D. Software. All Rights Reserved
  2.  
  3. // OOFTEST4
  4.  
  5. // this sample just demonstrates the report-writer
  6.  
  7. // Simple stream I/O is used to interact with the user.
  8. #include "oofile.hpp"
  9. #include "oofrw.hpp"
  10.  
  11.  
  12. #include "ooftst02.inc"
  13.  
  14. int main()
  15. {
  16.     cout << "OOFILE Validation Suite - Test 4\n"
  17.          << "Simple test to demonstrate use of the report-writer" << endl
  18.          << "using the database from ooftest2 and output to a file" << endl;
  19.  
  20.     if (dbConnect::fileExists("ooftst02.db"))
  21.         theDB.openConnection("ooftst02.db");
  22.     else {
  23.         theDB.newConnection("ooftst02.db");
  24.         Patients.AddTestData();
  25.     }
  26.  
  27.     Patients.setSortOrder(Patients.LastName);
  28.     cout << "Listing records to ooftst04.out...";
  29.     ofstream fs("ooftst04.out");
  30.     
  31.     dbView theView(Patients); 
  32.     theView << Patients.PatientNo << Patients.LastName << Patients.Salary; 
  33.  
  34.     dbRepChar tempReport(dbRepSizer("Demo Columnar Report").pageHeight(80),
  35.                     dbRepColWidths() << 8 << 10 << 30, theView);
  36.     tempReport.draw(fs);
  37.  
  38.      fs << endl << endl << "Repeating the report with the same data view"<< endl << endl;
  39.     
  40.     dbRepChar tempReport2(dbRepSizer("Demo Columnar Report").pageHeight(80),
  41.                      theView, dbRep::pageWise);
  42.     tempReport2.draw(fs);
  43.  
  44.     fs.close();
  45.     
  46.     cout << "done" << endl;
  47.  
  48.     return EXIT_SUCCESS;
  49. }